<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/animate.css/3.5.2/animate.min.css">
</head>
<body>
    <div id="app">
        <button @click="comp=(comp==='my-a'?'my-b':'my-a')">切换组件</button>
        <component :is="comp"></component>
    </div>
        
</body>
<script src="./base/vue.js"></script>

<script>
    //通过 :is 这个属性可以实现组件之间的切换
    Vue.component("my-a",{
        template:"<h1>我是my-a组件！</h1>"
    })
    Vue.component("my-b",{
        template:"<h1>我是my-b组件！</h1>"
    })

    new Vue({
        el:"#app",
        data:{
            comp:"my-a"
        }
    })

</script>
</html>